home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume19 / rkive / part02 < prev    next >
Encoding:
Internet Message Format  |  1989-06-29  |  55.3 KB

  1. Subject:  v19i099:  Usenet sources archiver, Part02/04
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Kent Landfield <ssbell!kent>
  7. Posting-number: Volume 19, Issue 99
  8. Archive-name: rkive/part02
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 2 (of 4)."
  17. # Contents:  Makefile article.1 article.c ckconfig.c format.c
  18. #   record_arc.c rkive.5 rkive.h
  19. # Wrapped by kent@ssbell on Thu Jun  1 16:19:08 1989
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'Makefile'\"
  23. else
  24. echo shar: Extracting \"'Makefile'\" \(6450 characters\)
  25. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  26. X##########################################################
  27. X#
  28. X#    @(#)Makefile    1.1 6/1/89 - USENET Source Archiver
  29. X#
  30. X#
  31. X# This software is Copyright (c) 1989 by Kent Landfield.
  32. X#
  33. X# Permission is hereby granted to copy, distribute or otherwise 
  34. X# use any part of this package as long as you do not try to make 
  35. X# money from it or pretend that you wrote it.  This copyright 
  36. X# notice must be maintained in any copy made.
  37. X#
  38. X# Use of this software constitutes acceptance for use in an AS IS 
  39. X# condition. There are NO warranties with regard to this software.  
  40. X# In no event shall the author be liable for any damages whatsoever 
  41. X# arising out of or in connection with the use or performance of this 
  42. X# software.  Any use of this software is at the user's own risk.
  43. X#
  44. X#  If you make modifications to this software that you feel 
  45. X#  increases it usefulness for the rest of the community, please 
  46. X#  email the changes, enhancements, bug fixes as well as any and 
  47. X#  all ideas to me. This software is going to be maintained and 
  48. X#  enhanced as deemed necessary by the community.
  49. X#        
  50. X#        Kent Landfield
  51. X#        uunet!ssbell!kent
  52. X#
  53. X#  History:
  54. X#    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  55. X#                                                               
  56. X##########################################################
  57. X#
  58. X# Which mkdir function do you want to use ?
  59. X#
  60. X# Define HAVE_MKDIR if there is a mkdir() function in your 
  61. X# system library (AT&T 5.2 or earlier systems are probably
  62. X# out of luck..)
  63. X#
  64. X# Define USE_SYSMKDIR if you wish to system off /bin/mkdir.
  65. X# (not recommended for *real* use...)
  66. X#
  67. X# If you do not define either, the function makedir will
  68. X# create the directory itself. 
  69. X#
  70. X#CFLAGS=-O -DUSE_SYSMKDIR
  71. X#CFLAGS=-O -DHAVE_MKDIR
  72. XCFLAGS= -O 
  73. X#
  74. X# Define your favorite C compiler here...
  75. X#
  76. XCC=gcc
  77. X
  78. X#
  79. X# Define flags to be passed to lint.
  80. X#
  81. XLINTFLAGS=
  82. X
  83. X#
  84. X# rkive needs to have POSIX Compatible directory access routines.
  85. X# If you have it builtin to your system libraries then
  86. X# comment out the following. If you use Doug Gwyn's routines, (or 
  87. X# other compatible routines) define the library in which they appear.
  88. X#
  89. XLDFLAGS=-lndir
  90. X
  91. XI = /usr/include
  92. XLP = /usr/lbin/clist
  93. XNROFF = /usr/bin/nroff
  94. XBINDIR=/usr/lbin
  95. X
  96. XDOCS = article.1 rkive.1 ckconfig.1 rkive.5
  97. XSUPPORT = rkive.cf Makefile README IDEAS MANIFEST
  98. XINCLUDES = rkive.h article.h cfg.h patchlevel.h
  99. X
  100. XARTICLE_SRCS =  article.c efopen.c format.c header.c str.c version.c
  101. XARTICLE_OBJS =  article.o efopen.o format.o header.o str.o version.o
  102. X
  103. XCKCONFIG_SRCS = ckconfig.c disp_grp.c efopen.c setup.c str.c version.c
  104. XCKCONFIG_OBJS = ckconfig.o disp_grp.o efopen.o setup.o str.o version.o
  105. X
  106. XARCHIVE_SRCS =  disp_grp.c efopen.c format.c header.c \
  107. X        makedir.c news_arc.c record_arc.c rename.c \
  108. X        rkive.c setup.c str.c version.c
  109. XARCHIVE_OBJS =  disp_grp.o efopen.o format.o header.o \
  110. X        makedir.o news_arc.o record_arc.o rename.o \
  111. X        rkive.o setup.o str.o version.o
  112. X
  113. XSRCS = article.c ckconfig.c disp_grp.c efopen.c format.c \
  114. X    header.c news_arc.c rkive.c rename.c record_arc.c \
  115. X    makedir.c setup.c str.c version.c
  116. X
  117. XPROGS = article ckconfig rkive
  118. X
  119. Xall: $(PROGS)
  120. X
  121. Xinstall: $(PROGS)
  122. X    strip $(PROGS)
  123. X    cp $(PROGS) $(BINDIR)
  124. X
  125. Xckconfig: $(CKCONFIG_OBJS)
  126. X    $(CC) $(CFLAGS) -o ckconfig $(CKCONFIG_OBJS)
  127. X
  128. Xarticle: $(ARTICLE_OBJS)
  129. X    $(CC) $(CFLAGS) -o article $(ARTICLE_OBJS)
  130. X
  131. Xrkive: $(ARCHIVE_OBJS)
  132. X    $(CC) $(CFLAGS) -o rkive $(ARCHIVE_OBJS) $(LDFLAGS)
  133. X
  134. Xman:
  135. X    $(NROFF) -man $(DOCS)
  136. X
  137. X################################
  138. X#        Dependencies
  139. X################################
  140. X
  141. Xrkive.o: $(I)/sys/types.h
  142. Xrkive.o: $(I)/sys/stat.h
  143. Xrkive.o: $(I)/dirent.h
  144. Xrkive.o: $(I)/stdio.h
  145. Xrkive.o: article.h
  146. Xrkive.o: cfg.h
  147. Xrkive.o: rkive.h
  148. X
  149. Xarticle.o: $(I)/stdio.h
  150. Xarticle.o: $(I)/ctype.h
  151. Xarticle.o: $(I)/sys/types.h
  152. Xarticle.o: article.h
  153. X
  154. Xckconfig.o: $(I)/sys/types.h
  155. Xckconfig.o: $(I)/dirent.h
  156. Xckconfig.o: $(I)/stdio.h
  157. Xckconfig.o: $(I)/pwd.h
  158. Xckconfig.o: $(I)/grp.h
  159. Xckconfig.o: cfg.h
  160. Xckconfig.o: rkive.h
  161. X
  162. Xdisp_grp.o: $(I)/sys/types.h
  163. Xdisp_grp.o: $(I)/dirent.h
  164. Xdisp_grp.o: $(I)/stdio.h
  165. Xdisp_grp.o: $(I)/pwd.h
  166. Xdisp_grp.o: $(I)/grp.h
  167. Xdisp_grp.o: cfg.h
  168. Xdisp_grp.o: rkive.h
  169. X
  170. Xefopen.o: $(I)/stdio.h
  171. X
  172. Xformat.o: $(I)/stdio.h
  173. Xformat.o: $(I)/sys/types.h
  174. Xformat.o: article.h
  175. X
  176. Xheader.o: $(I)/stdio.h
  177. Xheader.o: $(I)/ctype.h
  178. Xheader.o: $(I)/sys/types.h
  179. Xheader.o: article.h
  180. X
  181. Xmakedir.o: $(I)/sys/types.h
  182. Xmakedir.o: $(I)/sys/stat.h
  183. Xmakedir.o: $(I)/stdio.h
  184. Xmakedir.o: $(I)/dirent.h
  185. Xmakedir.o: rkive.h
  186. X
  187. Xnews_arc.o: $(I)/sys/types.h
  188. Xnews_arc.o: $(I)/sys/stat.h
  189. Xnews_arc.o: $(I)/dirent.h
  190. Xnews_arc.o: $(I)/stdio.h
  191. Xnews_arc.o: $(I)/ctype.h
  192. Xnews_arc.o: article.h
  193. Xnews_arc.o: cfg.h
  194. Xnews_arc.o: rkive.h
  195. X
  196. Xrecord_arc.o: $(I)/sys/types.h
  197. Xrecord_arc.o: $(I)/sys/stat.h
  198. Xrecord_arc.o: $(I)/dirent.h
  199. Xrecord_arc.o: $(I)/stdio.h
  200. Xrecord_arc.o: cfg.h
  201. Xrecord_arc.o: rkive.h
  202. X
  203. Xrename.o: $(I)/stdio.h
  204. X
  205. Xsetup.o: $(I)/sys/types.h
  206. Xsetup.o: $(I)/sys/stat.h
  207. Xsetup.o: $(I)/stdio.h
  208. Xsetup.o: $(I)/ctype.h
  209. Xsetup.o: $(I)/pwd.h
  210. Xsetup.o: $(I)/grp.h
  211. Xsetup.o: $(I)/dirent.h
  212. Xsetup.o: cfg.h
  213. Xsetup.o: rkive.h
  214. X
  215. Xversion.o: $(I)/stdio.h
  216. Xversion.o: patchlevel.h
  217. X
  218. X################################
  219. X#           Print
  220. X################################
  221. X
  222. Xprint: print_docs print_support print_include 
  223. X    $(LP) $(SRCS)
  224. X
  225. Xprint_support:
  226. X     pr $(SUPPORT) | lp
  227. X
  228. Xprint_include:
  229. X    $(LP) $(INCLUDES)
  230. X
  231. Xprint_article:
  232. X    $(LP) $(ARTICLE_SRCS)
  233. X
  234. Xprint_ckconfig:
  235. X    $(LP) $(CKCONFIG_SRCS)
  236. X
  237. Xprint_rkive:
  238. X    $(LP) $(ARCHIVE_SRCS)
  239. X
  240. Xprint_docs:
  241. X    $(NROFF) -man $(DOCS) | os | lp
  242. X
  243. X################################
  244. X#           LINT
  245. X################################
  246. X
  247. Xlint:  
  248. X    @echo "linting Article sources: " > Lint.out
  249. X    lint $(LINTFLAGS) $(ARTICLE_SRCS) | tee -a Lint.out
  250. X    @echo "linting Ckconfig sources: " >> Lint.out
  251. X    lint $(LINTFLAGS) $(CKCONFIG_SRCS) | tee -a Lint.out
  252. X    @echo "linting Archiver sources: " >> Lint.out
  253. X    lint $(LINTFLAGS) $(ARCHIVE_SRCS) | tee -a Lint.out
  254. X
  255. Xlint_article:
  256. X    @echo "linting Article sources: " > Lint.out
  257. X    lint $(LINTFLAGS) $(ARTICLE_SRCS) 2>&1 | tee -a Lint.out
  258. X
  259. Xlint_ckconfig:
  260. X    @echo "linting Ckconfig sources: " > Lint.out
  261. X    lint $(LINTFLAGS) $(CKCONFIG_SRCS) | tee -a Lint.out
  262. X
  263. Xlint_rkive:
  264. X    @echo "linting Archiver sources: " > Lint.out
  265. X    lint $(LINTFLAGS) $(ARCHIVE_SRCS) | tee -a Lint.out
  266. X
  267. X################################
  268. X#              CLEANUP        
  269. X################################
  270. X
  271. Xclean:
  272. X    rm -f *.o Lint.out
  273. X
  274. Xclobber: clean
  275. X    rm -f $(PROGS)
  276. X
  277. Xinspection:  
  278. X    -inspect -abv $(ARTICLE_SRCS) 
  279. X    -inspect -abv $(CKCONFIG_SRCS) 
  280. X    -inspect -abv $(ARCHIVE_SRCS) 
  281. X
  282. Xinspect_rkive:
  283. X    -inspect -abv $(ARCHIVE_SRCS) 
  284. END_OF_FILE
  285. if test 6450 -ne `wc -c <'Makefile'`; then
  286.     echo shar: \"'Makefile'\" unpacked with wrong size!
  287. fi
  288. # end of 'Makefile'
  289. fi
  290. if test -f 'article.1' -a "${1}" != "-c" ; then 
  291.   echo shar: Will not clobber existing file \"'article.1'\"
  292. else
  293. echo shar: Extracting \"'article.1'\" \(5160 characters\)
  294. sed "s/^X//" >'article.1' <<'END_OF_FILE'
  295. X'br "@(#)article.1    1.1 6/1/89"
  296. X.op 1i
  297. X.TH ARTICLE 1
  298. X.SH NAME
  299. Xarticle \- print formatted news article header information
  300. X.SH SYNOPSIS
  301. X.B article
  302. X[ -adnvV ] [-f format ] newsarticle [ ... ]
  303. X.SH DESCRIPTION
  304. X.I article
  305. Xallows the user to display information contained in the news article 
  306. Xheaders. This information includes the auxiliary headers added by the 
  307. Xmoderators of most of the source newsgroups.
  308. X.I article
  309. Xtakes the names of article files from standard input or as specified 
  310. Xon the command line. By default, 
  311. X.I article 
  312. Xproduces output in a format of:
  313. X.PP
  314. X(Newsarticle                     Article Subject)
  315. Xsources.d/1210           Re:  Archiving USENET Software             
  316. X.PP
  317. XIf the user has specified that only potential archive members are to
  318. Xbe displayed, article produces output in a format of:
  319. X.PP   
  320. X(Newsarticle  Archive Name           Article Description)
  321. Xunix/1420   archive/part01   Source Archiver, Part 1 of 8
  322. X.PP
  323. XThe user can select almost any information contained within a news article
  324. Xheader and can then specify the way in which the information should be
  325. Xdisplayed. The format that the user specifies is much like that of a
  326. XC printf statement. 
  327. X.SH OPTIONS
  328. X.IP "-a" 6
  329. XPrint information (in the specified format if supplied) if and only if 
  330. Xthe news article contains the auxiliary headers added by the sources 
  331. Xnewsgroup moderators. Do not print any information about files that do 
  332. Xnot contain auxiliary headers.
  333. X.IP "-d" 
  334. XTurn on debugging output. This option allows the user to display the 
  335. Xinformation found in an article header. This is basically a formatted dump 
  336. Xof the header structure after parsing the article's header.
  337. X.IP "-f format"
  338. XThis option allows the user to specify a format.  The format is used to 
  339. Xdetermine which parts of the article header information are to be displayed. 
  340. XIt also specifies the presentation format of the article information in 
  341. Xmuch the same manner as the C printf function.  See Formatting below.
  342. X.IP "-n" 
  343. XPrint information (in the specified format if supplied) if and only if 
  344. Xthe news article does not contains the auxiliary headers added by the 
  345. Xsources newsgroup moderators.
  346. X.IP "-v"
  347. XPrint additional information about the newsgroup.
  348. X.IP "-V"
  349. XPrint the version and patchlevel of the current executable.
  350. X.SH FORMATTING 
  351. X.PP
  352. X.I article
  353. Xplaces output on the standard output stream stdout.  
  354. X.I article 
  355. Xselects, formats, and prints its output under control of the format.  
  356. XThe format is a character string that contains two types of objects: 
  357. Xplain characters, which are copied directly to the output stream, and 
  358. Xselection specifications. Specifying a selection results in fetching 
  359. Xthe selected items from the news article.  The results are undefined 
  360. Xif there is no associated information found in the news article.
  361. X.PP
  362. XEach selection specification is introduced by the character %.  After 
  363. Xthe %, a character follows that indicates the type of selection to be
  364. Xmade.
  365. X.PP
  366. XThe selection characters and their meanings are:
  367. X.nf
  368. X
  369. X        Article Information Lines
  370. X
  371. X        A - Print the Approved line.
  372. X        C - Print the Supersedes line.
  373. X        D - Print the Date line.
  374. X        F - Print the From line.
  375. X        K - Print the Keywords line.
  376. X        L - Print the Lines line.
  377. X        M - Print the Message-ID line.
  378. X        N - Print the Newsgroups line.
  379. X        P - Print the Path line.
  380. X        R - Print the References line.
  381. X        S - Print the Subject line.
  382. X        a - Print the Archive-name line.
  383. X        b - Print the Submitted-by line.
  384. X        c - Print the Control line.
  385. X        d - Print the Distribution line.
  386. X        e - Print the Expires line.
  387. X        f - Print the Followup-to line.
  388. X        o - Print the Organization line.
  389. X        p - Print the Posting-number line.
  390. X        r - Print the Reply-to line.
  391. X        s - Print the Sender line.
  392. X        u - Print the Summary line.
  393. X        x - Print the Xref line.
  394. X
  395. X        Archive Information 
  396. X
  397. X        B - Print the base file name.
  398. X        O - Print the Full path of the specified file.
  399. X        G - Print the newsGroup name.
  400. X        i - Print the issue (if archive) line.
  401. X        l - Print the Author's logon address line.
  402. X        n - Print the Author's name.
  403. X        v - Print the volume (if archive) line.
  404. X
  405. X        Additional Specification Characters 
  406. X
  407. X        T - Print the Subject line's topic information.
  408. X        % - Print a %, no argument is converted.
  409. X..nr
  410. X.PP
  411. XIn addition to the conversion characters, the following 
  412. Xcharacters have meaning during the formatting of the output.
  413. X.nr
  414. X
  415. X    \\n - Print a new-line in the output.
  416. X    \\t - Print a tab in the output.
  417. X.nf
  418. X.SH EXAMPLES 
  419. X.PP
  420. XTo print all files in the sources directory that have auxiliary 
  421. Xheaders and can be archived by Archive-Name or Volume-Issue methods:
  422. X.PP
  423. X$ find /usr/spool/news/comp/sources -print | article -a
  424. X.PP
  425. XTo print a list of files in 
  426. X.PP
  427. X$ cd /usr/spool/news/comp/sources; article -f"%O  %T" unix/*
  428. X.RS
  429. X.IP
  430. Xunix/1843    Introduction to comp.sources.unix    
  431. Xunix/1844    List of sources in the archives    
  432. X.RE
  433. X.SH "SEE ALSO"
  434. Xrkive(1), ckconfig(1), rkive.cf(5)
  435. X.SH BUGS
  436. X.I article
  437. Xdoes not know about the X-Archiver format used in Volume 1 of comp.sources.misc.
  438. X.LP
  439. END_OF_FILE
  440. if test 5160 -ne `wc -c <'article.1'`; then
  441.     echo shar: \"'article.1'\" unpacked with wrong size!
  442. fi
  443. # end of 'article.1'
  444. fi
  445. if test -f 'article.c' -a "${1}" != "-c" ; then 
  446.   echo shar: Will not clobber existing file \"'article.c'\"
  447. else
  448. echo shar: Extracting \"'article.c'\" \(5446 characters\)
  449. sed "s/^X//" >'article.c' <<'END_OF_FILE'
  450. X/*
  451. X**                                                                
  452. X**  Subsystem:   USENET Sources Archiver             
  453. X**  File Name:   article.c               
  454. X**                                                        
  455. X**  usage: article [ -adnvV ] [-f format ] newsarticle [ ... ]
  456. X**
  457. X**
  458. X** This software is Copyright (c) 1989 by Kent Landfield.
  459. X**
  460. X** Permission is hereby granted to copy, distribute or otherwise 
  461. X** use any part of this package as long as you do not try to make 
  462. X** money from it or pretend that you wrote it.  This copyright 
  463. X** notice must be maintained in any copy made.
  464. X**
  465. X** Use of this software constitutes acceptance for use in an AS IS 
  466. X** condition. There are NO warranties with regard to this software.  
  467. X** In no event shall the author be liable for any damages whatsoever 
  468. X** arising out of or in connection with the use or performance of this 
  469. X** software.  Any use of this software is at the user's own risk.
  470. X**
  471. X**  If you make modifications to this software that you feel 
  472. X**  increases it usefulness for the rest of the community, please 
  473. X**  email the changes, enhancements, bug fixes as well as any and 
  474. X**  all ideas to me. This software is going to be maintained and 
  475. X**  enhanced as deemed necessary by the community.
  476. X**        
  477. X**        Kent Landfield
  478. X**        uunet!ssbell!kent
  479. X**
  480. X**  History:
  481. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  482. X**                                                               
  483. X*/
  484. Xchar sccsid[] = "@(#)article.c    1.1 6/1/89";
  485. X
  486. X#include <stdio.h>
  487. X#include <ctype.h>
  488. X#include <sys/types.h>
  489. X#include "article.h"
  490. X
  491. X#define ARCHIVE_ONLY  1
  492. X#define NO_ARCHIVE   -1
  493. X
  494. X#define USAGE  "usage: %s [ -adnvV ] [-f format ] newsarticle [ ... ]\n"
  495. X
  496. Xchar *progname;                 /* name of executable              */
  497. Xchar *format_ptr = NULL;        /* pointer to user supplied format */
  498. Xint verify_archive = 0;         /* archive verification needed ?   */
  499. XFILE *errfp;                    /* standard error file pointer     */
  500. XFILE *logfp;                    /* standard output file pointer    */
  501. X
  502. Xchar *strchr();                 /* external function declaration   */
  503. X
  504. Xmain(argc, argv)
  505. Xint argc;
  506. Xchar **argv;
  507. X{
  508. X   int c;
  509. X   extern char *optarg;
  510. X   extern int optind;
  511. X
  512. X   progname = argv[0];
  513. X   debug = verbose = 0;
  514. X   logfp = stdout;
  515. X   errfp = stderr;
  516. X
  517. X   if (argc > 1) {
  518. X      while ((c = getopt(argc, argv, "adnvVf:")) != EOF) {
  519. X         switch (c) {
  520. X             case 'a':
  521. X                 verify_archive = ARCHIVE_ONLY;
  522. X                 break;
  523. X             case 'd':
  524. X                 debug++;
  525. X                 break;
  526. X             case 'f':
  527. X                 format_ptr = optarg;
  528. X                 break;
  529. X             case 'n':
  530. X                 verify_archive = NO_ARCHIVE;
  531. X                 break;
  532. X             case 'v':
  533. X                 verbose++;
  534. X                 break;
  535. X             case 'V':
  536. X                 version();
  537. X             default:
  538. X                 (void) fprintf(errfp,USAGE, progname);
  539. X                 return(1);
  540. X         }
  541. X      }
  542. X   }
  543. X
  544. X   if ((optind >= argc) || (argc == 1)) {  /* file from stdin */
  545. X        char buf[BUFSIZ];
  546. X        while (fgets(buf,sizeof buf,stdin) != NULL) {
  547. X               buf[strlen(buf) -1] = '\0';
  548. X               article_header(buf);
  549. X        }
  550. X   }
  551. X   else { 
  552. X        for (; optind < argc; optind++)    /* process files to print */
  553. X             article_header(argv[optind]);
  554. X   }
  555. X   return(0);                              /* terminate this process */
  556. X}
  557. X
  558. Xarticle_header(flname)
  559. X    char *flname;
  560. X{
  561. X    char *dp;
  562. X    int header_ok = 0;
  563. X    char *strcpy();
  564. X    FILE *file, *efopen();
  565. X
  566. X    int default_format = ARTICLE;
  567. X
  568. X    init_article();
  569. X
  570. X    file = efopen(flname,"r");
  571. X
  572. X    (void) strcpy(article.newsarticle,flname);
  573. X
  574. X    while (fgets(s,sizeof s,file) != NULL) {
  575. X        /*
  576. X        ** Check if the line is not a header line.
  577. X        ** Allow 2 lines to go by that are not header
  578. X        ** lines. In this manner, the auxilliary sources
  579. X        ** headers can be interpreted.
  580. X        */
  581. X        if (!isalpha(*s) || (strchr(s,':') == NULL)) {
  582. X           ++header_ok;
  583. X           if (header_ok == 2) {
  584. X               /* 
  585. X               ** Has the user requested to produce 
  586. X               ** only an archive listing ?
  587. X               */
  588. X               if (verify_archive == ARCHIVE_ONLY) {
  589. X                  if (!header.archive_name[0] || !article.description[0])
  590. X                       break;
  591. X                   default_format = ARCHIVE;
  592. X               }
  593. X               /* 
  594. X               ** Has the user requested to produce 
  595. X               ** a listing excluding all archive 
  596. X               ** potential members ?
  597. X               */
  598. X               else if (verify_archive == NO_ARCHIVE) {
  599. X                   if (header.archive_name[0] && article.description[0]) 
  600. X                       break;
  601. X                   default_format = ARTICLE;
  602. X               }
  603. X               /* 
  604. X               ** Print out the information as requested
  605. X               */
  606. X               format_output(logfp, format_ptr, flname, default_format);
  607. X               break;
  608. X            }
  609. X            continue;
  610. X        }
  611. X
  612. X        dp = s;
  613. X        while (*++dp)
  614. X           if (*dp == '\n')
  615. X               *dp = '\0';
  616. X        /*
  617. X        ** Determine the type of the line and then
  618. X        ** store the line in its appropriate structure
  619. X    ** element for later retrieval.
  620. X        */
  621. X        store_line();
  622. X    }
  623. X    (void) fclose(file);
  624. X
  625. X    if (verbose)
  626. X        dump_article();
  627. X}
  628. END_OF_FILE
  629. if test 5446 -ne `wc -c <'article.c'`; then
  630.     echo shar: \"'article.c'\" unpacked with wrong size!
  631. fi
  632. # end of 'article.c'
  633. fi
  634. if test -f 'ckconfig.c' -a "${1}" != "-c" ; then 
  635.   echo shar: Will not clobber existing file \"'ckconfig.c'\"
  636. else
  637. echo shar: Extracting \"'ckconfig.c'\" \(4959 characters\)
  638. sed "s/^X//" >'ckconfig.c' <<'END_OF_FILE'
  639. X/*
  640. X**                                                                
  641. X**  Subsystem:   USENET Sources Archiver             
  642. X**  File Name:   ckconfig.c               
  643. X**                                                        
  644. X**  usage: config [ -gV ] [ -f config_file ]
  645. X**
  646. X**
  647. X** This software is Copyright (c) 1989 by Kent Landfield.
  648. X**
  649. X** Permission is hereby granted to copy, distribute or otherwise 
  650. X** use any part of this package as long as you do not try to make 
  651. X** money from it or pretend that you wrote it.  This copyright 
  652. X** notice must be maintained in any copy made.
  653. X**
  654. X** Use of this software constitutes acceptance for use in an AS IS 
  655. X** condition. There are NO warranties with regard to this software.  
  656. X** In no event shall the author be liable for any damages whatsoever 
  657. X** arising out of or in connection with the use or performance of this 
  658. X** software.  Any use of this software is at the user's own risk.
  659. X**
  660. X**  If you make modifications to this software that you feel 
  661. X**  increases it usefulness for the rest of the community, please 
  662. X**  email the changes, enhancements, bug fixes as well as any and 
  663. X**  all ideas to me. This software is going to be maintained and 
  664. X**  enhanced as deemed necessary by the community.
  665. X**        
  666. X**        Kent Landfield
  667. X**        uunet!ssbell!kent
  668. X**
  669. X**  History:
  670. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  671. X**                                                               
  672. X*/
  673. Xchar sccsid[] = "@(#)ckconfig.c    1.1 6/1/89";
  674. X
  675. X#include <sys/types.h>
  676. X#include <dirent.h>
  677. X#include <stdio.h>
  678. X#include <pwd.h>
  679. X#include <grp.h>
  680. X#include "cfg.h"
  681. X
  682. X#define M1 "The following values are used if the administrator has"
  683. X#define M2 "not set a value for a necessary configuration item(s)."
  684. X#define USAGE  "usage: %s [ -gV ] [ -f config_file ]\n"
  685. X
  686. Xextern struct passwd *pw;
  687. Xextern struct group *gr;
  688. X
  689. Xstruct passwd *getpwuid();
  690. Xstruct group *getgrgid();
  691. X
  692. Xmain(argc,argv)
  693. Xint argc;
  694. Xchar **argv;
  695. X{
  696. X   int c;
  697. X   extern char *optarg;
  698. X   extern int optind;
  699. X
  700. X   logfp = stdout;
  701. X   errfp = stderr;
  702. X   progname = argv[0];
  703. X   fill_in_defaults = 0;
  704. X   config_file = LOCATION;
  705. X
  706. X   if (argc > 1) {
  707. X      while ((c = getopt(argc, argv, "gVf:")) != EOF) {
  708. X         switch (c) {
  709. X             case 'f':
  710. X                 config_file = optarg;
  711. X                 break;
  712. X             case 'g':
  713. X                 fill_in_defaults++;
  714. X                 break;
  715. X             case 'V':
  716. X                 version();
  717. X             default:
  718. X                 (void) fprintf(errfp,USAGE, progname);
  719. X                 return(1);
  720. X         }
  721. X      }
  722. X   }
  723. X   setup_defaults();
  724. X
  725. X   display_config();
  726. X   return(0);
  727. X}
  728. X
  729. X
  730. Xdisplay_config()
  731. X{
  732. X    register int i;
  733. X
  734. X    (void) fprintf(logfp,"\n\t\tConfiguration Check for %s\n", 
  735. X                         config_file);
  736. X
  737. X    (void) fprintf(logfp,"\n\t\t\tGlobal Defines\n\n");
  738. X
  739. X    (void) fprintf(logfp,"News Directory:      %s\n",spooldir);
  740. X    (void) fprintf(logfp,"Problems Directory:  %s\n",problems_dir);
  741. X    (void) fprintf(logfp,"Global Logfile:      %s\n",
  742. X                         *log ? log : "NO LOGGING");
  743. X    (void) fprintf(logfp,"Global Index:        %s\n", 
  744. X                         *index ? index:"NO INDEXING");
  745. X    (void) fprintf(logfp,"Logfile Format:      %s\n",
  746. X                         *log_format ? log_format : "NOT SPECIFIED");
  747. X    (void) fprintf(logfp,"Index Format:        %s\n",
  748. X                         *index_format ? index_format : "NOT SPECIFIED");
  749. X    (void) fprintf(logfp,"Mail Results To:     %s\n\n", 
  750. X                         *mail ? mail : "NO ONE");
  751. X    (void) fprintf(logfp,"%s\n%s\n\n",  M1, M2);
  752. X    (void) fprintf(logfp,"Archive Type:    %s\n",
  753. X                         default_type == ARCHIVE_NAME ? "Archive-Name": 
  754. X                         default_type == VOLUME_ISSUE ? "Volume-Issue":
  755. X                                                        "Article-Number"); 
  756. X    (void) fprintf(logfp,"Patches Type:    %s\n",
  757. X                         default_patch_type == PACKAGE ? "Package" :
  758. X                                                         "Historical");
  759. X
  760. X
  761. X    pw = getpwuid(default_owner);
  762. X    (void) fprintf(logfp,"Default Owner:   %d <%s>\n", 
  763. X                         default_owner,pw->pw_name);
  764. X
  765. X    gr = getgrgid(default_group);
  766. X    (void) fprintf(logfp,"Default Group:   %d <%s>\n", 
  767. X                         default_group, gr->gr_name);
  768. X    (void) fprintf(logfp,"Default Modes:   %o\n", default_modes);
  769. X    (void) fprintf(logfp,"Compression:     %s\n\n",
  770. X                          *compress ? compress : "NO COMPRESSION");
  771. X
  772. X    if (default_patch_type == PACKAGE && default_type != ARCHIVE_NAME) {
  773. X        (void) fprintf(logfp,"WARNING: Package Patches archiving is only\n");
  774. X        (void) fprintf(logfp,"         used with Archive-Name archiving.\n\n");
  775. X    }
  776. X
  777. X    (void) fprintf(logfp,"\t\tNewsgroup Archive Configuration\n\n\n");
  778. X    for (i = 0; i <= num; i++)  {
  779. X         display_group_info(&group[i]);
  780. X         (void) fprintf(logfp,"\n\n");
  781. X    }
  782. X    return;
  783. X}
  784. END_OF_FILE
  785. if test 4959 -ne `wc -c <'ckconfig.c'`; then
  786.     echo shar: \"'ckconfig.c'\" unpacked with wrong size!
  787. fi
  788. # end of 'ckconfig.c'
  789. fi
  790. if test -f 'format.c' -a "${1}" != "-c" ; then 
  791.   echo shar: Will not clobber existing file \"'format.c'\"
  792. else
  793. echo shar: Extracting \"'format.c'\" \(7380 characters\)
  794. sed "s/^X//" >'format.c' <<'END_OF_FILE'
  795. X/*
  796. X**
  797. X** This software is Copyright (c) 1989 by Kent Landfield.
  798. X**
  799. X** Permission is hereby granted to copy, distribute or otherwise 
  800. X** use any part of this package as long as you do not try to make 
  801. X** money from it or pretend that you wrote it.  This copyright 
  802. X** notice must be maintained in any copy made.
  803. X**
  804. X**
  805. X**  History:
  806. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  807. X**                                                               
  808. X*/
  809. X#ifndef lint
  810. Xstatic char SID[] = "@(#)format.c    1.1 6/1/89";
  811. X#endif
  812. X
  813. X#include <stdio.h>
  814. X#include <sys/types.h>
  815. X#include "article.h"
  816. X
  817. Xextern FILE *errfp;
  818. X
  819. Xchar *itoa(n)
  820. Xint n;
  821. X{
  822. X    static char str[20];
  823. X
  824. X    int i, c, j, sign;
  825. X    
  826. X    if ((sign = n) < 0) 
  827. X    n = -n;
  828. X
  829. X    i = 0;
  830. X    do {
  831. X        str[i++] = n % 10 + '0';
  832. X    } while ((n /= 10) > 0);
  833. X
  834. X    if (sign < 0)
  835. X        str[i++] = '-';
  836. X    str[i] = '\0';
  837. X
  838. X    for (i = 0, j = strlen(str)-1; i < j; i++,j--) {
  839. X        c = str[i];
  840. X        str[i] = str[j];
  841. X        str[j] = c;
  842. X    }
  843. X    return(str);
  844. X}
  845. X
  846. Xchar *add_string(ptr, member_str)
  847. Xchar *ptr, *member_str;
  848. X{
  849. X    while(*member_str)
  850. X        *ptr++ = *member_str++;
  851. X    return(ptr);
  852. X}
  853. X
  854. X
  855. Xchar *basename(name)
  856. X    char *name;
  857. X{
  858. X    char *p;
  859. X    char *strrchr();
  860. X    
  861. X    if ((p = strrchr(name,'/')) == NULL)
  862. X        return(name);
  863. X    return(++p);
  864. X}
  865. X
  866. X
  867. Xformat_output(fp, frmptr, filename, default_type)
  868. XFILE *fp;              /* Output file pointer                   */
  869. Xchar *frmptr;          /* Selection Format pointer              */
  870. Xchar *filename;        /* File name the info came from          */
  871. Xint default_type;      /* Where called from, Rkive or Article   */
  872. X{
  873. X    char *basename();
  874. X    char *aptr, *cp, c;
  875. X    char format[BUFSIZ];
  876. X    void exit();
  877. X    /* Did the user specify a format to use   */
  878. X    /* or should the default format be used ? */
  879. X
  880. X    if (frmptr == NULL) {
  881. X       if (default_type == ARCHIVE) 
  882. X           (void) fprintf(fp,"%-s\t%-s\t%s\n",
  883. X                 article.newsarticle, header.archive_name,
  884. X                 article.description);
  885. X       else
  886. X           (void) fprintf(fp,"%-s\t%-s\n", filename, header.subject);
  887. X       return;
  888. X    }
  889. X
  890. X    for (cp = format; cp < format + BUFSIZ; cp++)
  891. X         *cp = '\0';
  892. X    aptr = frmptr;
  893. X    cp = format;
  894. X
  895. X    while (c = *aptr++) {
  896. X        if (c == '%') {
  897. X           switch (*aptr++) {
  898. X               case '%':
  899. X                   *cp++ = '%';
  900. X                   continue;
  901. X               case 'A':     /* Approved  */
  902. X                   cp = add_string(cp, header.approved);
  903. X                   continue;
  904. X               case 'B':     /* Base name of the file path  */
  905. X                   cp = add_string(cp, basename(filename));
  906. X                   continue;
  907. X               case 'C':     /* Supersedes  */
  908. X                   cp = add_string(cp, header.supersedes);
  909. X                   continue;
  910. X               case 'D':     /* Date  */
  911. X                   cp = add_string(cp, header.subdate);
  912. X                   continue;
  913. X               case 'F':     /* From */
  914. X                   cp = add_string(cp, header.from);
  915. X                   continue;
  916. X               case 'G':     /* newGroups disk location */
  917. X                   cp = add_string(cp, article.newsgroup);
  918. X                   continue;
  919. X               case 'K':     /* Keywords  */
  920. X                   cp = add_string(cp, header.keywords);
  921. X                   continue;
  922. X               case 'L':     /* Lines */
  923. X                   cp = add_string(cp, header.numlines);
  924. X                   continue;
  925. X               case 'M':     /* Message-ID */
  926. X                   cp = add_string(cp, header.ident);
  927. X                   continue;
  928. X               case 'N':     /* Newsgroups */
  929. X                   cp = add_string(cp, header.nbuf);
  930. X                   continue;
  931. X               case 'O':     /* Actual Archived filename */
  932. X                   cp = add_string(cp, filename);
  933. X                   continue;
  934. X               case 'P':     /* Path  */
  935. X                   cp = add_string(cp, header.path);
  936. X                   continue;
  937. X               case 'R':     /* References  */
  938. X                   cp = add_string(cp, header.references);
  939. X                   continue;
  940. X               case 'S':     /* Subject  */
  941. X                   cp = add_string(cp, header.subject);
  942. X                   continue;
  943. X               case 'T':     /* Subject Topic  */
  944. X                   cp = add_string(cp, article.description);
  945. X                   continue;
  946. X               case 'V':     /* Volume-Issue article filename  */
  947. X                   cp = add_string(cp, article.filename);
  948. X                   continue;
  949. X               case 'a':     /* Archive-name */
  950. X                   cp = add_string(cp, header.archive_name);
  951. X                   continue;
  952. X               case 'b':     /* Submitted-by */
  953. X                   cp = add_string(cp, header.submitted_by);
  954. X                   continue;
  955. X               case 'c':     /* Control  */
  956. X                   cp = add_string(cp, header.ctlmsg);
  957. X                   continue;
  958. X               case 'd':     /* Distribution  */
  959. X                   cp = add_string(cp, header.distribution);
  960. X                   continue;
  961. X               case 'e':     /* Expires  */
  962. X                   cp = add_string(cp, header.expdate);
  963. X                   continue;
  964. X               case 'f':     /* Followup-to  */
  965. X                   cp = add_string(cp, header.followup_to);
  966. X                   continue;
  967. X               case 'i':     /* issue (if archive) */
  968. X                   cp = add_string(cp,itoa(article.issue));
  969. X                   continue;
  970. X               case 'l':     /* Author's logon address */
  971. X                   cp = add_string(cp, article.author_signon);
  972. X                   continue;
  973. X               case 'n':     /* Author's name */
  974. X                   cp = add_string(cp, article.author_name);
  975. X                   continue;
  976. X               case 'o':     /* Organization */
  977. X                   cp = add_string(cp, header.organization);
  978. X                   continue;
  979. X               case 'p':     /* Posting-number */
  980. X                   cp = add_string(cp, header.posting_num);
  981. X                   continue;
  982. X               case 'r':     /* Reply-to */
  983. X                   cp = add_string(cp, header.replyto);
  984. X                   continue;
  985. X               case 's':     /* Sender  */
  986. X                   cp = add_string(cp, header.sender);
  987. X                   continue;
  988. X               case 't':     /* Patch-To  */
  989. X                   cp = add_string(cp, header.patch_to);
  990. X                   continue;
  991. X               case 'u':     /* Summary */
  992. X                   cp = add_string(cp, header.summary);
  993. X                   continue;
  994. X               case 'v':     /* volume (if archive) */
  995. X                   cp = add_string(cp,itoa(article.volume));
  996. X                   continue;
  997. X               case 'x':     /* Xref */
  998. X                   cp = add_string(cp, header.xref);
  999. X                   continue;
  1000. X               default:
  1001. X                  (void) fprintf(errfp, "invalid format - %c\n", *--aptr);
  1002. X                  exit(2);
  1003. X           }    /* end switch */
  1004. X        }
  1005. X        else if (c == '\134') {
  1006. X           switch (*aptr++) {
  1007. X               case 'n':
  1008. X                   *cp++ = '\n';
  1009. X                   continue;
  1010. X               case 't':
  1011. X                   *cp++ = '\t';
  1012. X                   continue;
  1013. X           }
  1014. X        }
  1015. X        *cp++ = c;
  1016. X     }  /* end while */
  1017. X
  1018. X     (void) fprintf(fp, "%s\n", format);
  1019. X     return;
  1020. X}
  1021. END_OF_FILE
  1022. if test 7380 -ne `wc -c <'format.c'`; then
  1023.     echo shar: \"'format.c'\" unpacked with wrong size!
  1024. fi
  1025. # end of 'format.c'
  1026. fi
  1027. if test -f 'record_arc.c' -a "${1}" != "-c" ; then 
  1028.   echo shar: Will not clobber existing file \"'record_arc.c'\"
  1029. else
  1030. echo shar: Extracting \"'record_arc.c'\" \(5492 characters\)
  1031. sed "s/^X//" >'record_arc.c' <<'END_OF_FILE'
  1032. X/*
  1033. X**
  1034. X** This software is Copyright (c) 1989 by Kent Landfield.
  1035. X**
  1036. X** Permission is hereby granted to copy, distribute or otherwise 
  1037. X** use any part of this package as long as you do not try to make 
  1038. X** money from it or pretend that you wrote it.  This copyright 
  1039. X** notice must be maintained in any copy made.
  1040. X**
  1041. X**
  1042. X**  History:
  1043. X**    Creation: Tue Feb 21 08:52:35 CST 1989 due to necessity.
  1044. X**                                                               
  1045. X*/
  1046. X#ifndef lint
  1047. Xstatic char SID[] = "@(#)record_arc.c    1.1 6/1/89";
  1048. X#endif
  1049. X
  1050. X#include <sys/types.h>
  1051. X#include <sys/stat.h>
  1052. X#include <dirent.h>
  1053. X#include <stdio.h>
  1054. X#include "cfg.h"
  1055. X
  1056. Xstatic char work[BUFSIZ];
  1057. Xstatic int len;
  1058. Xstatic FILE *archived_fp;
  1059. X
  1060. XFILE *fopen();
  1061. XFILE *efopen();
  1062. X
  1063. Xextern int test;
  1064. Xextern struct group_archive *newsgrp;
  1065. X
  1066. X/*
  1067. X** needs_to_be_archived:
  1068. X**
  1069. X** int needs_to_be_archived(filename) char *filename; { return(0); }
  1070. X**
  1071. X** This function is used to determine if the filename
  1072. X** passed to it requires archiving. If the filename is
  1073. X** found in the .archived file, it has been previously
  1074. X** archived and does not need to be now. If it is not
  1075. X** found in the .archived file, it needs to be archived.
  1076. X*/
  1077. X
  1078. Xint needs_to_be_archived(filename)
  1079. X    char *filename;
  1080. X{
  1081. X    /*
  1082. X    ** If the .archived file is missing, it must be
  1083. X    ** the first time that it is to be archived.
  1084. X    */
  1085. X    if ((archived_fp = fopen(newsgrp->arc_done,"r")) == NULL) 
  1086. X    return(1);
  1087. X
  1088. X    len = strlen(filename);
  1089. X    while (fgets(work, sizeof work, archived_fp) != NULL) {
  1090. X        if (*work == '#')
  1091. X            continue;
  1092. X        if (strncmp(work,filename,len) == 0) {
  1093. X            (void) fclose(archived_fp);
  1094. X            return(0);
  1095. X        }
  1096. X    }
  1097. X    (void) fclose(archived_fp);
  1098. X    return(1);
  1099. X}
  1100. X
  1101. X/*
  1102. X** remove_expired:
  1103. X**
  1104. X** This function is used to maintain the .archived file in the
  1105. X** newsgroup's archive BASEDIR directory. This file is used to assure
  1106. X** that files are not archived over and over and that the 
  1107. X** administrator does not need to wait until the files have
  1108. X** expired before they are added to the archive. 
  1109. X** The .archived file stores a list of filenames of files that have been 
  1110. X** archived already. The remove_expired function removes filenames 
  1111. X** from the .archived file that no longer exist. In this manner the 
  1112. X** file is self maintaining. Expired entries are removed.
  1113. X*/
  1114. X
  1115. Xremove_expired()
  1116. X{
  1117. X    char news_file[20];
  1118. X    char fl_loc[MAXNAMLEN];
  1119. X    char tmp_loc[MAXNAMLEN];
  1120. X    FILE *tmp_archived;
  1121. X    struct stat stbuf;
  1122. X
  1123. X    /* Is this being run as a test ? */
  1124. X
  1125. X    if (test)
  1126. X        return;
  1127. X
  1128. X    /* Is this the first time this group is to be archived ? */
  1129. X
  1130. X    if (stat(newsgrp->arc_done, &stbuf) < 0) 
  1131. X        return;
  1132. X    
  1133. X    /* open the necessary files, creating a temp file */
  1134. X    (void) sprintf(tmp_loc,"%s/.arch_tmp", newsgrp->location);
  1135. X
  1136. X    tmp_archived = efopen(tmp_loc,"w");
  1137. X    archived_fp = efopen(newsgrp->arc_done,"r");
  1138. X
  1139. X    /* 
  1140. X    ** for every line in the .archived file,
  1141. X    **    check it comment line. If so, save it in the temp file
  1142. X    **    strip the string of any blanks or tabs inadvertantly 
  1143. X    **      added by admin in manual mode (editor)
  1144. X    **    check to see if the file still exists.
  1145. X    **    if so, write filename to the temp file
  1146. X    ** endfor
  1147. X    */
  1148. X
  1149. X    while (fgets(work, sizeof work, archived_fp) != NULL) {
  1150. X        if (*work == '#')      /* maintain comments in .archived */
  1151. X            (void) fprintf(tmp_archived,work);
  1152. X        else {
  1153. X            (void) sscanf(work, "%s %s", news_file, fl_loc);
  1154. X            if (stat(news_file, &stbuf) == 0) 
  1155. X                (void) fprintf(tmp_archived,work);
  1156. X        }
  1157. X    }
  1158. X
  1159. X    /*
  1160. X    ** Close both files and rename the temp 
  1161. X    ** file to the new .archived file.
  1162. X    */
  1163. X
  1164. X    (void) fclose(tmp_archived);
  1165. X    (void) fclose(archived_fp);
  1166. X    (void) rename(tmp_loc,newsgrp->arc_done);
  1167. X    return;
  1168. X}
  1169. X
  1170. X/*
  1171. X** get_archived_rec:
  1172. X**
  1173. X** get_archived_rec(filename) char *filename; { return(filename); }
  1174. X**
  1175. X** get_archived_rec is used to determine if the filename
  1176. X** passed to it has been archived. If its name is found
  1177. X** in the .archived file, it has been previously archived
  1178. X** and its archive information record is  returned to the
  1179. X** caling routine. Else it returns NULL.
  1180. X*/
  1181. X
  1182. Xchar *get_archived_rec(filename)
  1183. X    char *filename;
  1184. X{
  1185. X    /*
  1186. X    ** If the .archived file is missing, it must be
  1187. X    ** the first time that it is to be archived.
  1188. X    */
  1189. X    if ((archived_fp = fopen(newsgrp->arc_done,"r")) == NULL) 
  1190. X    return(NULL);
  1191. X
  1192. X    len = strlen(filename);
  1193. X    while (fgets(work, sizeof work, archived_fp) != NULL) {
  1194. X        if (*work == '#')
  1195. X            continue;
  1196. X        if (strncmp(work,filename,len) == 0) {
  1197. X            (void) fclose(archived_fp);
  1198. X            *(work+(strlen(work)-1)) = '\0';
  1199. X            return(work);
  1200. X        }
  1201. X    }
  1202. X    (void) fclose(archived_fp);
  1203. X    return(NULL);
  1204. X}
  1205. X
  1206. X/*
  1207. X** write_archived:
  1208. X**
  1209. X** write_archived(filename, path) char *filename, path; {}
  1210. X**
  1211. X** This function is used to write a filename and its archived location
  1212. X** to the .archived file in the newsgroup's archive BASEDIR
  1213. X** directory since we do not want it rearchived tomorrow.
  1214. X*/
  1215. X
  1216. Xwrite_archived(filename, path)
  1217. X    char *filename;
  1218. X    char *path;
  1219. X{
  1220. X    FILE *fp;
  1221. X
  1222. X    /* 
  1223. X    ** If in test mode no actual operations are 
  1224. X    ** to be done...
  1225. X    */
  1226. X    if (test)
  1227. X        return;
  1228. X
  1229. X    /*
  1230. X    ** open the file and append the record
  1231. X    */
  1232. X
  1233. X    fp = efopen(newsgrp->arc_done,"a+");
  1234. X    (void) fprintf(fp,"%s %s\n",filename, path);
  1235. X    (void) fclose(fp);
  1236. X    return;
  1237. X}
  1238. END_OF_FILE
  1239. if test 5492 -ne `wc -c <'record_arc.c'`; then
  1240.     echo shar: \"'record_arc.c'\" unpacked with wrong size!
  1241. fi
  1242. # end of 'record_arc.c'
  1243. fi
  1244. if test -f 'rkive.5' -a "${1}" != "-c" ; then 
  1245.   echo shar: Will not clobber existing file \"'rkive.5'\"
  1246. else
  1247. echo shar: Extracting \"'rkive.5'\" \(8629 characters\)
  1248. sed "s/^X//" >'rkive.5' <<'END_OF_FILE'
  1249. X'br "@(#)rkive.5    1.1 6/1/89"
  1250. X.TH RKIVE 5
  1251. X.SH NAME
  1252. Xrkive.cf \- USENET Source Archiver Configuration File.
  1253. X.SH DESCRIPTION
  1254. X.I rkive.cf
  1255. Xallows the administrator to configure the way in which USENET sources
  1256. Xare archived.
  1257. X.PP
  1258. XThe configuration file is used to indicate where the archives are
  1259. Xto be located, who will own the archive members, etc. The configuration 
  1260. Xfile is divided into two sections, a global section and the individual 
  1261. Xnewsgroup specifications.
  1262. X.PP
  1263. XThe syntax of the individual line types are as follows:
  1264. X.RS
  1265. X.IP "Global Variable Line"
  1266. XVariable = value
  1267. X.IP "Newsgroup Identifier"
  1268. X$$comp.source.whatever
  1269. X.IP "Newsgroup Variable Line"
  1270. XVariable : value
  1271. X.RE
  1272. X.LP
  1273. XNote that the '=' is used to designate a global variable and
  1274. Xthat the ':' is used to determine a newsgroup variable.
  1275. X.PP
  1276. XThe global variables are divided up into variables that pertain to
  1277. Xall archiving as well as defaults to be used in the event that the
  1278. Xarchive administrator has not set a specific value for a "defaultable"
  1279. Xvariable.
  1280. X.PP
  1281. X.SH "GLOBAL VARIABLES"
  1282. X.PP
  1283. X.IP "SPOOLDIR =" 15
  1284. XThis is the base directory for the news subsystem.
  1285. X.IP "PROBLEMS ="
  1286. XThe name of the base directory used to store any duplicate or "problem"
  1287. Xarticles that rkive(1) cannot deal with. All articles are stored under 
  1288. Xthis directory in a newsgroup / volume directory structure.
  1289. X.IP "LOG ="
  1290. XThe location of the master log in which actions are logged. 
  1291. XIf this variable is not set, no logging takes place.
  1292. X.IP "LOG_FORMAT ="
  1293. XThe format of the records of the master log file.  This variable only
  1294. Xpertains to the global log file format. The actual format specification
  1295. Xmust be enclosed in "". See article(1) for a discussion of the available 
  1296. Xselection format capabilities.
  1297. X.IP "INDEX =" 
  1298. XThe location of the master index file (if one is to be kept).  The index 
  1299. Xcan be used to interface with the netlib source retrieval software facility.
  1300. X.IP "INDEX_FORMAT ="
  1301. XThe format of the records of the master index file. The actual format
  1302. Xspecification must be enclosed in "".   See article(1) for a
  1303. Xdiscussion of the available selection format capabilities.
  1304. X.IP "MAIL ="
  1305. XIf specified, logged actions are mailed to the users listed. 
  1306. XThe user names are a comma separated list. It is not necessary to
  1307. Xspecify any users. 
  1308. X.PP
  1309. XThe following values are used if the administrator has not
  1310. Xset a value for a corresponding newsgroup configuration item.
  1311. X.IP "TYPE =" 15
  1312. XThis is the default archive type.  There are 3 possible ways
  1313. Xin which to archive USENET sources,
  1314. X.RS
  1315. X.IP
  1316. XVolume-Issue, Archive-Name or Article Number.
  1317. X.RE
  1318. X.IP
  1319. XThese are used to determine if you wish the articles archived in a 
  1320. X.RS
  1321. X.IP
  1322. X/basedir/amiga/Volume1/v001i22 or /basedir/amiga/Volume1/sitonit or
  1323. X/basedir/amiga/Volume1/44 format.
  1324. X.RE
  1325. X.IP "PATCHES ="
  1326. XThis variable determines the way in which patches are installed into 
  1327. Xthe archive. If the PATCHES entry is not defined either globally or within
  1328. Xthe newsgroup, the article is handled as a regular article and is stored 
  1329. Xaccording to the specified parameters of the newsgroup. The following are
  1330. Xthe valid possible values for the PATCHES variable:
  1331. X.RS
  1332. X.IP "PATCHES=Historical" 6 
  1333. XThis is the same as if no PATCHES entry existed at all. It is useful 
  1334. Xif Historical patches archiving is the default but there are certain 
  1335. Xnewsgroups that have it specified differently.
  1336. X.IP "PATCHES=Package"
  1337. XPackage patches archiving allows the inbound patch to be placed with 
  1338. Xthe directory with the initially posted articles. In this manner
  1339. Xall parts and fixes of a package are together making it easier for 
  1340. Xsoftware retrieval by uucp requests and mail request facilities
  1341. Xsuch as netlib.
  1342. X.RE
  1343. X.IP "OWNER ="
  1344. XThe owner of the archive files after they are stored in the archive.
  1345. X.IP "GROUP ="
  1346. XThe group ownership of the archive files after they are stored in the archive.
  1347. X.IP "MODE ="
  1348. XThe default modes of the files residing in the archive.
  1349. X.IP "COMPRESS =" 
  1350. XThe location of the compression utility if the files are to be reduced.
  1351. XIf this variable is specified, it must contain the full path to the command
  1352. Xused to perform the compression.
  1353. X.PP
  1354. XThe following is a sample global variable section.
  1355. X.PP
  1356. X.nf
  1357. XSPOOLDIR=/usr/spool/news      
  1358. XPROBLEMS=/usenet/problems
  1359. XLOG=/usenet/archive.log
  1360. XLOG_FORMAT= "%O %T %l" 
  1361. XINDEX= /usenet/index
  1362. XINDEX_FORMAT= "%a %T" 
  1363. XMAIL=kent,rick,chris
  1364. XTYPE= Archive-Name
  1365. XPATCHES= Package
  1366. XOWNER=src
  1367. XGROUP=archive
  1368. XMODE=0444
  1369. X#COMPRESS=/usr/lbin/compress
  1370. X.nr
  1371. X.PP
  1372. XIn the above sample, if any of the individual newsgroups had not
  1373. Xhad the type of the archive specified, the type would have defaulted
  1374. Xto an Archive-Name (if the newsgroup had the auxiliary headers required
  1375. Xto support Archive-Name). By default, no compression was to be done. All
  1376. Xresults would have been mailed to the accounts of kent, rick and chris.
  1377. XIf a newsgroup had not specified the ownership and modes of the destination
  1378. Xarchive members, the values specified in the global OWNER, GROUP, and MODE
  1379. Xwould have been used.
  1380. X.LP
  1381. X.SH "NEWSGROUP SPECIFICATIONS"
  1382. X.PP
  1383. X.PP
  1384. XAn individual newsgroup entry is identified by a $$ as the first two
  1385. Xcharacters of the line. The name of the newsgroup (in newsgroup format)
  1386. Xfollows such as
  1387. X.IP
  1388. X$$comp.sources.unix        
  1389. X.LP
  1390. X.IP "BASEDIR :" 15
  1391. XThis is the base directory for the archive.
  1392. X.IP "LOG :"
  1393. XThe location of the log file in which actions are logged. 
  1394. XIf this variable is not set, no logging takes place.
  1395. X.IP "LOG_FORMAT :"
  1396. XThe format of the records of the log file.  The actual format
  1397. Xspecification must be enclosed in "".  See article(1) for a 
  1398. Xdiscussion of the available selection format capabilities.
  1399. X.IP "INDEX :" 
  1400. XThe location of the index file (if one is to be kept).  The index can be 
  1401. Xused to interface with the netlib source retrieval software facility.
  1402. X.IP "INDEX_FORMAT :"
  1403. XThe format of the records of the index file.  The actual format
  1404. Xspecification must be enclosed in "".  See article(1) for a
  1405. Xdiscussion of the available selection format capabilities.
  1406. X.IP "MAIL :"
  1407. XIf specified, logged actions are mailed to the list of users specified. 
  1408. XThe user names are a comma separated list. It is not necessary to
  1409. Xspecify any users. 
  1410. X.IP "TYPE :" 
  1411. XThis is the archive type.  There are 3 possible ways
  1412. Xin which to archive USENET sources,
  1413. X.RS
  1414. X.IP
  1415. XVolume-Issue, Archive-Name or Article Number.
  1416. X.RE
  1417. X.IP "PATCHES ="
  1418. XThis variable determines the way in which patches are installed into 
  1419. Xthe newsgroup's archive. If the PATCHES entry is not defined either 
  1420. Xglobally or within the newsgroup, the article is handled as a regular 
  1421. Xarticle and is stored according to the specified parameters of the 
  1422. Xnewsgroup. The following are the valid possible values for the 
  1423. XPATCHES variable:
  1424. X.RS
  1425. X.IP "PATCHES: Historical" 6 
  1426. XThis is the same as if no PATCHES entry existed at all. It is useful 
  1427. Xif Historical patches archiving is the default but there are certain 
  1428. Xnewsgroups that have it specified differently.
  1429. X.IP "PATCHES: Package"
  1430. XPackage patches archiving allows the inbound patch to be placed with 
  1431. Xthe directory with the initially posted articles. In this manner
  1432. Xall parts and fixes of a package are together making it easier for 
  1433. Xsoftware retrieval by uucp requests and mail request facilities
  1434. Xsuch as netlib.
  1435. X.RE
  1436. X.IP "OWNER :"
  1437. XThe the owner of the files after they are stored in the archive 
  1438. Xdirectory for the newsgroup.
  1439. X.IP "GROUP :"
  1440. XThe group ownership of the archive files after they are stored in the 
  1441. Xarchive directory for the newsgroup.
  1442. X.IP "MODE :"
  1443. XThe default modes of the files residing in the archive directory.
  1444. X.IP "COMPRESS :" 
  1445. XThe location of the compression utility if the files are to be reduced.
  1446. XIf this variable is specified, it must contain the full path to the command
  1447. Xused to perform the compression.
  1448. X.PP
  1449. XA sample entry for comp.sources.unix might look like:
  1450. X.nf
  1451. X$$comp.sources.unix        
  1452. X    BASEDIR: /usenet/unix 
  1453. X    TYPE: Volume-Issue
  1454. X    PATCHES: Historical
  1455. X    OWNER: kent
  1456. X    GROUP: support
  1457. X    MODE: 0664
  1458. X    INDEX: /usenet/unix/index
  1459. X    INDEX_FORMAT: "%O %a %S" 
  1460. X    COMPRESS: /usr/lbin/compress
  1461. X    MAIL: kent,bob,sally
  1462. X.nr
  1463. X.PP
  1464. XIn the above sample, comp.sources.unix would be archived in /usenet/unix.
  1465. XThe individual volume directories would be created there. All files would
  1466. Xbe owned by kent and the group support. The files would be writable by the
  1467. Xgroup as well as the owner. (Not a smart idea but just for examples sake.)
  1468. XLogging is not being done although an index entry is being generated for
  1469. Xeach article archived. All files stored in the archive for this newsgroup
  1470. Xare to be compressed using the compress program in /usr/lbin. Mail is sent 
  1471. Xto kent, bob and sally when the archiving of comp.sources.unix has been
  1472. Xcompleted. 
  1473. X.SH "SEE ALSO"
  1474. Xrkive(1), article(1), ckconfig(1)
  1475. X.LP
  1476. END_OF_FILE
  1477. if test 8629 -ne `wc -c <'rkive.5'`; then
  1478.     echo shar: \"'rkive.5'\" unpacked with wrong size!
  1479. fi
  1480. # end of 'rkive.5'
  1481. fi
  1482. if test -f 'rkive.h' -a "${1}" != "-c" ; then 
  1483.   echo shar: Will not clobber existing file \"'rkive.h'\"
  1484. else
  1485. echo shar: Extracting \"'rkive.h'\" \(7464 characters\)
  1486. sed "s/^X//" >'rkive.h' <<'END_OF_FILE'
  1487. X/*
  1488. X**     @(#)rkive.h    1.1 6/1/89 
  1489. X**
  1490. X**    This is the rkive source configuration header file. 
  1491. X**    Please examine and change to suite your own site's needs..
  1492. X**
  1493. X*/
  1494. X
  1495. X/*
  1496. X** The default owner, group and modes of the archived files
  1497. X** need to be stated below. The values are only used if the
  1498. X** appropriate values are not in the configuration file.
  1499. X*/ 
  1500. X
  1501. X#define OWNER    0
  1502. X#define GROUP    3
  1503. X#define MODES    0444
  1504. X
  1505. X/* 
  1506. X** If you have a smart mailer that supports a "-s subject" command
  1507. X** and you wish to have the subject line added when archived mail
  1508. X** is sent, define SUBJECT_LINE. 
  1509. X*/
  1510. X
  1511. X#define SUBJECT_LINE 
  1512. X
  1513. X#ifdef SUBJECT_LINE
  1514. X#define MAIL        "/usr/bin/mailx"     /* mail program to use */
  1515. X/* #define MAIL        "/usr/local/bin/elm" */
  1516. X#else
  1517. X#define MAIL        "/bin/mail"     /* mail program to use */
  1518. X#endif
  1519. X
  1520. X/*
  1521. X** The PROBLEMS_DIR is the default directory to use in the event 
  1522. X** problems are encountered such as duplicate article names and 
  1523. X** the execution flags do not specify overwriting. 
  1524. X**
  1525. X** The new, inbound article is stored in the PROBLEMS_DIR in the 
  1526. X** problems_dir/newsgroup/volume/filename so that the administrator 
  1527. X** can review and fix the problem whenever time becomes available...
  1528. X**
  1529. X** The PROBLEMS_DIR define is used only if the administrator has not 
  1530. X** specified the PROBLEMS path variable inside of the LOCATION 
  1531. X** (config) file.
  1532. X*/
  1533. X
  1534. X#define PROBLEMS_DIR "/usenet/problems"  
  1535. X
  1536. X/* 
  1537. X** Home directory for news    
  1538. X*/
  1539. X
  1540. X#define SPOOLDIR     "/usr/spool/news"   
  1541. X
  1542. X/* 
  1543. X** Location of the default rkive configuration file.
  1544. X*/
  1545. X
  1546. X#define LOCATION     "/usr/local/lib/rkive.cf"  
  1547. X
  1548. X/*
  1549. X** Defines to control the handling of repostings.
  1550. X**
  1551. X** ADD_REPOST_SUFFIX && REPOST_SUFFIX
  1552. X**
  1553. X**     If ADD_REPOST_SUFFIX is defined, all reposts will have the 
  1554. X**     string specified in REPOST_SUFFIX appended to the archive
  1555. X**     filename so that a repost of elm/part07 would appear in
  1556. X**     the archive as elm/part07-repost prior to any compression.
  1557. X**
  1558. X**     CAUTION: This should *not* be used on a filesystem with
  1559. X**        14 character file name limits. If you are going
  1560. X**        to be making your archive available to the general
  1561. X**        community do *not* use this. The portability of
  1562. X**        filenames is greatly reduced. This has been added
  1563. X**        with much hesitation. The rational was that there
  1564. X**        was no reason to punish/limit the functionality
  1565. X**        just because of limitations of a specific "brand"
  1566. X**        of unix and since that "brand" was correcting its
  1567. X**        "error" in the future, why not put it in now ?
  1568. X**        This is not a configuration item on a per newsgroup
  1569. X**        basis. It might be useful for Historical archiving
  1570. X**        using only Volume/Issue archiving with no COMPRESSION.
  1571. X**
  1572. X** MV_ORIGINAL
  1573. X**     The original article is placed into a "original" directory in 
  1574. X**     the problems directory (if duplicated). The inbound reposted
  1575. X**     article is placed into the archive in the correct position.
  1576. X**
  1577. X** No Reposting Defines specified:
  1578. X**    The inbound article would be placed into the archive in the 
  1579. X**    correct position only if the initial article is not in the archive.
  1580. X**    Otherwise the reposted article is placed in the problems directory 
  1581. X**    as a normal duplicate article is now.
  1582. X*/
  1583. X
  1584. X/* #define ADD_REPOST_SUFFIX */
  1585. X#define MV_ORIGINAL 
  1586. X
  1587. X#ifdef ADD_REPOST_SUFFIX 
  1588. X#define REPOST_SUFFIX  "-repost" 
  1589. X#endif
  1590. X
  1591. X/* 
  1592. X** If you wish your volume directories to be Volume, VOL, vOLuMe
  1593. X** or any other such nonsense, change the VOLUME define below.
  1594. X*/
  1595. X
  1596. X#define VOLUME       "volume"
  1597. X
  1598. X/* 
  1599. X** If you wish to have the headers "trimmed" when the file is archived,
  1600. X** assure that REDUCE_HEADERS is defined. Currenlty all header lines that
  1601. X** are not either;
  1602. X**     From:, Newsgroups:, Subject:, Message-ID:, and Date:
  1603. X** will be removed. See news_arc.c if you wish to add or subtract header
  1604. X** lines to keep. This can produce a savings of between 200 to 500 bytes
  1605. X** per archived article.
  1606. X*/
  1607. X
  1608. X#define REDUCE_HEADERS 
  1609. X
  1610. X/* 
  1611. X** The following define specifies a default format for generating
  1612. X** index file records in the event that there is no index format
  1613. X** specified for either the newsgroup or for the global default.
  1614. X** See article.1 for a discussion of the different types of selection
  1615. X** characters available for use in the format specifications.
  1616. X*/
  1617. X
  1618. X#define DEFAULT_INDEX_FORMAT       "%B\t%S"
  1619. X
  1620. X/* 
  1621. X** The following define specifies a default format for generating
  1622. X** log file records in the event that there is no log format
  1623. X** specified for either the newsgroup or for the global default.
  1624. X*/
  1625. X#define DEFAULT_LOG_FORMAT         "%O\t%T"
  1626. X
  1627. X/*
  1628. X** The size of the group array. If you are archiving the world
  1629. X** you might need to bump this up...
  1630. X*/
  1631. X
  1632. X#define NUM_NEWSGROUPS  32
  1633. X
  1634. X/**********************************************************************
  1635. X*******************  NO CHANGES REQUIRED PAST HERE  *******************
  1636. X**********************************************************************/
  1637. X
  1638. X/*
  1639. X** check to assure repost defines are in order...
  1640. X*/
  1641. X
  1642. X#if defined(ADD_REPOST_SUFFIX) + defined(MV_ORIGINAL) > 1
  1643. X#include "ERROR - Can only specify a maximum of one way to handle reposts!"
  1644. X#endif
  1645. X
  1646. X/*
  1647. X** Standard stuff
  1648. X*/
  1649. X
  1650. X#ifndef TRUE
  1651. X#define TRUE   1
  1652. X#endif
  1653. X
  1654. X#ifndef FALSE
  1655. X#define FALSE  0
  1656. X#endif
  1657. X
  1658. X/*
  1659. X** archive type defines 
  1660. X**
  1661. X** These defines are used to determine which type of archiving 
  1662. X** methods the administrator has requested for the newsgroup.
  1663. X**
  1664. X*/
  1665. X
  1666. X#define ARCHIVE_NAME     0    /* Archive as "elm/part03"  */
  1667. X#define VOLUME_ISSUE     1    /* Archive as "v16i003"     */
  1668. X#define ARTICLE_NUMBER   2    /* Archive with same name   */
  1669. X                /* as the file to archive   */
  1670. X
  1671. X/*
  1672. X** patch handling type defines 
  1673. X**
  1674. X** These defines are used to determine which type of 
  1675. X** method the administrator has requested for the the
  1676. X** handling of patches received in the newsgroup.
  1677. X**
  1678. X*/
  1679. X
  1680. X#define HISTORICAL   0        /* Archive as normally done.        */
  1681. X#define PACKAGE      1        /* Archive patches in the directory */
  1682. X                                /* containing the initial posting.  */
  1683. X
  1684. Xstruct group_archive {
  1685. X    int owner;                  /* owner id of the archive files     */
  1686. X    int group;                  /* group id of the archive files     */
  1687. X    int modes;                  /* modes of the stored archive files */
  1688. X    int type;                   /* Type of archiving to be used.     */
  1689. X                /*        0 = Archive-Name           */
  1690. X                                /*        1 = Volume-Issue           */
  1691. X                                /*        2 = Article-Number         */
  1692. X    int patch_type;             /* Method of handling patches.       */
  1693. X                                /*        0 = Historical             */
  1694. X                                /*        1 = Package                */
  1695. X    char ng_name[MAXNAMLEN];    /* Newsgroup to be archived.         */
  1696. X    char location[MAXNAMLEN];    /* Path to archive's base directory. */
  1697. X    char arc_done[MAXNAMLEN];    /* Archive's .archived already file  */
  1698. X    char mail_list[BUFSIZ];    /* List of users to mail when new    */
  1699. X                /* members are added to the archive. */
  1700. X    char logfile[MAXNAMLEN];    /* Path to archive specific log file */
  1701. X    char index[MAXNAMLEN];     /* Path to archive specific index.   */
  1702. X    char patchlog[MAXNAMLEN];    /* Path to archive's patches log.    */
  1703. X    char logformat[BUFSIZ];    /* Format of the logfile entry.      */
  1704. X    char indformat[BUFSIZ];    /* Format of the index entry.        */
  1705. X    char compress[MAXNAMLEN];    /* Command line to use to compress   */
  1706. X                /* new archive members, optional.    */
  1707. X};
  1708. END_OF_FILE
  1709. if test 7464 -ne `wc -c <'rkive.h'`; then
  1710.     echo shar: \"'rkive.h'\" unpacked with wrong size!
  1711. fi
  1712. # end of 'rkive.h'
  1713. fi
  1714. echo shar: End of archive 2 \(of 4\).
  1715. cp /dev/null ark2isdone
  1716. MISSING=""
  1717. for I in 1 2 3 4 ; do
  1718.     if test ! -f ark${I}isdone ; then
  1719.     MISSING="${MISSING} ${I}"
  1720.     fi
  1721. done
  1722. if test "${MISSING}" = "" ; then
  1723.     echo You have unpacked all 4 archives.
  1724.     rm -f ark[1-9]isdone
  1725. else
  1726.     echo You still need to unpack the following archives:
  1727.     echo "        " ${MISSING}
  1728. fi
  1729. ##  End of shell archive.
  1730. exit 0
  1731.  
  1732.